package com.hdaccp.cloud.controller;

import com.hdaccp.cloud.bean.Users;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import java.util.List;

@RestController
public class UsersController {
    private static final String REST_URL_PREFIX = "http://localhost:6001/";
    //private static final String REST_URL_PREFIX = "http://T170CLOUD01";
    @Autowired
    private RestTemplate restTemplate;

    @RequestMapping(value = "/queryAllUsers")
    public List<Users> query()
    {
        return restTemplate.getForObject(REST_URL_PREFIX + "/query",List.class) ;
      //  return restTemplate.postForObject(REST_URL_PREFIX + "/query",List.class) ;
    }

}
